<?php
/**
* Copyright 2009 Waag Society <http://www.waag.org>
* This file is part of Annotrax.
*
* Annotrax is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* Annotrax is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Annotrax.
* If not, see http://www.gnu.org/licenses/gpl.html
*/
?>

<?php echo $this->form ?>


<?php
/*
// view script for add movies
$this->headScript()->appendFile('/swfupload/swfupload.js' );
if( !Zend_Session::isStarted() ){
	Zend_Session::start();
}
?>
<h1><?php echo $this->translate("Add new movie") ?></h1>
<p><?php echo $this->translate("Select a new movie file to upload here. You can edit the other properties once the file has been uploaded") ?></p>
<form>
	<div id="movieUploadContainer" style="position: relative; background-color: #fcc; width: 120px;">
		<input style="position: absolute; top: 0px; id="movieUploadInput" type="file" />
		<div id="swfUploadPlacement" style="position: absolute; top: 0px;">
			<div id="movieUpload">
			</div>
		</div>
	</div>
</form>
<br/>
<p id="progress">
	<em>select a file</em>
</p>
<script>
var swfu;
window.onload = function(){
	swfu = new SWFUpload({
		// Backend settings
		flash_url : "/swfupload/swfupload.swf",
		upload_url: "/admin/movie/add/",
		post_params: {"PHPSESSID" : "<?php echo Zend_Session::getId() ?>"},
		file_post_name: "movie_file",

		// Flash file settings
		file_size_limit : "512 MB",
		file_types : "*.ogg;*.ogv;*.jpg",			// or you could use something like: "*.doc;*.wpd;*.pdf",
		file_types_description : "Ogg/theora video files",
		file_upload_limit : "1",
		file_queue_limit : "1",

		button_placeholder_id : "movieUpload",

		button_width: 224,
		button_height: 24,
		button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
		button_cursor: SWFUpload.CURSOR.HAND,
		button_text: "",

		file_dialog_start_handler: function( evt ){
			document.getElementById('progress').innerHTML = '<em>File selected</em>';
			console.log( 'START' );
		},

		file_dialog_complete_handler: function( fileName ){
			document.getElementById('progress').innerHTML = "<em>selected file \""+ fileName +"\"</em>";
		},

		file_queued_handler: function( data ){
			document.getElementById('progress').innerHTML = '<em>Upload started</em>';
			console.log( 'upload started' );
			swfu.startUpload();
		},

		upload_progress_handler: function( file, bytesLoaded, bytesTotal ){
			document.getElementById('progress').innerHTML = "<em>Uploading "+ bytesLoaded +" of "+ bytesTotal +" bytes</em>";
			//console.log("progress"); console.log([bytesLoaded, bytesTotal]);
		},

		upload_error_handler : function( evt ){
			console.log( 'error' );
			//console.log("error"); console.log(evt);
		},
		upload_complete_handler : function( evt ){
			console.log("complete");
			console.log(evt)
		},
		upload_success_handler : function( file, serverData ){
			console.log( 'success' );
			var data = eval('(' + serverData + ')');

			console.log( data );

			if(data.success){
				//console.log( data );
				window.location.href= data.location; //(data.location);
			}
			else{
				alert( data.message );
			}
		},
		debug: true,
	});
}

</script>
<?
*/
?>
